import { Column, CreateDateColumn, Entity, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { PermissionControlEntity } from '../permission-control/permission-control.entity';

@Entity('permissions')
export class PermissionEntity {

  @PrimaryGeneratedColumn()
  id;

  @Column()
  key: string;

  @Column()
  description: string;

  @Column({
    name: 'only_admin',
  })
  onlyAdmin: boolean = false;

  @Column({
    name: 'api_list',
    type: 'text',
  })
  apiList: string;

  @Column({
    name: 'deleted_at',
    type: 'datetime',
    nullable: true,
    select: false,
  })
  deletedAt: Date;

  @CreateDateColumn({
    name: 'created_at',
  })
  createdAt: Date;

  @UpdateDateColumn({
    name: 'updated_at',
  })
  updatedAt: Date;
}
